﻿using LightingServer;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;

namespace ImportMoudel
{
    public class ColRef
    {
        public string ColName { get; set; }
        public int Index { get; set; }
        public string CallMethod { get; set; }
        public bool IsRef { get; set; }
        public uint Guid { get; set; }
    }

    public abstract class TableRef
    {
        public abstract Type ClassType { get; }
        public abstract IList<ColRef> RefList { get; }
    }

    public class MainTable : TableRef
    {
        public override Type ClassType
        {
            get
            {
                return typeof(Lighting.Builder);
            }
        }

        private List<ColRef> _refList;
        public override IList<ColRef> RefList
        {
            get
            {
                if (_refList == null)
                {
                    _refList = new List<ColRef>()
                    {
                        new ColRef() {  ColName = "产品系列", CallMethod = "SetSeries", Index=5 },
                        new ColRef() {  ColName = "产品分类", CallMethod = "SetClass", IsRef=true, Guid = 1, Index=6 },
                        new ColRef() {  ColName = "使用场所", CallMethod = "SetPlace", IsRef=true, Guid = 2, Index=7 },
                        new ColRef() {  ColName = "规格型号", CallMethod = "SetVersion", Index=8 },
                        new ColRef() {  ColName = "产品品牌", CallMethod = "SetLable", Index=9 },
                        new ColRef() {  ColName = "产地", CallMethod = "SetOrgin", IsRef=true, Guid = 3, Index=12 },
                    };
                }
                return _refList;
            }
        }
    }

    public class PhysicalTable : TableRef
    {
        public override Type ClassType
        {
            get
            {

                return typeof(Physical.Builder);
            }
        }

        private List<ColRef> _refList;
        public override IList<ColRef> RefList
        {
            get
            {
                if (_refList == null)
                {
                    _refList = new List<ColRef>()
                    {
                         new ColRef() {  ColName = "材质说明", CallMethod = "SetMaterial", Index=13 },
                         new ColRef() {  ColName = "外观颜色", CallMethod = "SetColor", Index=14 },
                         new ColRef() {  ColName = "外形尺寸", CallMethod = "SetSize", Index=15 },
                         new ColRef() {  ColName = "防护等级", CallMethod = "SetDefend", Index=16},
                         new ColRef() {  ColName = "防撞击等级", CallMethod = "SetImpact", IsRef=true, Guid = 4, Index=18 },
                         new ColRef() {  ColName = "产品重量", CallMethod = "SetWeight", Index=19 }
                    };
                }
                return _refList;
            }
        }
    }


    public class OpticsTable : TableRef
    {
        public override Type ClassType
        {
            get
            {

                return typeof(Optics.Builder);
            }
        }

        private List<ColRef> _refList;
        public override IList<ColRef> RefList
        {
            get
            {
                if (_refList == null)
                {
                    _refList = new List<ColRef>()
                    {
                         new ColRef() {  ColName = "配光说明", CallMethod = "SetExplain", IsRef=true, Guid = 5, Index=21 },
                         new ColRef() {  ColName = "光束角", CallMethod = "SetAngle", Index=22 },
                         new ColRef() {  ColName = "灯具效率", CallMethod = "SetEfficiency", Index=23 },
                    };
                }
                return _refList;
            }
        }
    }



    public class ElectricTable : TableRef
    {
        public override Type ClassType
        {
            get
            {

                return typeof(Electric.Builder);
            }
        }

        private List<ColRef> _refList;
        public override IList<ColRef> RefList
        {
            get
            {
                if (_refList == null)
                {
                    _refList = new List<ColRef>()
                    {
                         new ColRef() {  ColName = "防触电等级", CallMethod = "SetShock", Index=24 },
                         new ColRef() {  ColName = "工作电压", CallMethod = "SetVoltage", IsRef=true, Guid = 6, Index=25},
                         new ColRef() {  ColName = "电器类型", CallMethod = "SetType", Index=26 },
                         new ColRef() {  ColName = "电器功耗", CallMethod = "SetElectricPower", Index=27 },
                         new ColRef() {  ColName = "光源功率", CallMethod = "SetLightingPower", Index=28 },
                         new ColRef() {  ColName = "整灯功耗", CallMethod = "SetAllPower", Index=29 },
                         new ColRef() {  ColName = "控制方式", CallMethod = "SetControlType", IsRef=true, Guid = 7, Index=31 },
                    };
                }
                return _refList;
            }
        }
    }


    public class AdapterLightingTable : TableRef
    {
        public override Type ClassType
        {
            get
            {

                return typeof(AdapterLighting.Builder);
            }
        }

        private List<ColRef> _refList;
        public override IList<ColRef> RefList
        {
            get
            {
                if (_refList == null)
                {
                    _refList = new List<ColRef>()
                    {
                         new ColRef() {  ColName = "光源种类", CallMethod = "SetClass", IsRef=true, Guid = 8, Index=32 },
                         new ColRef() {  ColName = "光源型号", CallMethod = "SetVersion", Index=34 },
                         new ColRef() {  ColName = "色温或颜色", CallMethod = "SetColor", Index=35 },
                         new ColRef() {  ColName = "显色性CRI", CallMethod = "SetCri", Index=36 },
                         new ColRef() {  ColName = "光输出", CallMethod = "SetOutput", Index=37 },
                         new ColRef() {  ColName = "插脚形式", CallMethod = "SetPins", Index=38 },
                    };
                }
                return _refList;
            }
        }
    }

    public class ProjectTable : TableRef
    {
        public override Type ClassType
        {
            get
            {

                return typeof(Project.Builder);
            }
        }

        private List<ColRef> _refList;
        public override IList<ColRef> RefList
        {
            get
            {
                if (_refList == null)
                {
                    _refList = new List<ColRef>()
                    {
                         new ColRef() {  ColName = "可选配件", CallMethod = "SetParts", Index=41 },
                         new ColRef() {  ColName = "安装方式", CallMethod = "SetSetup", IsRef=true, Guid = 9, Index=42},
                         new ColRef() {  ColName = "安装尺寸", CallMethod = "SetSize", Index=43 },
                         new ColRef() {  ColName = "认证及检测报告", CallMethod = "SetReport", Index=48 },
                         new ColRef() {  ColName = "备注", CallMethod = "SetBaikup", Index=49 }
                    };
                };
                return _refList;
            }
        }
    }


    public class BusinessTable : TableRef
    {
        public override Type ClassType
        {
            get
            {

                return typeof(Business.Builder);
            }
        }

        private List<ColRef> _refList;
        public override IList<ColRef> RefList
        {
            get
            {
                if (_refList == null)
                {
                    _refList = new List<ColRef>()
                    {
                        
                         new ColRef() {  ColName = "参考进价", CallMethod = "SetIn", Index=55 },
                         new ColRef() {  ColName = "市场参考价", CallMethod = "SetMarket", Index=56 },
                         new ColRef() {  ColName = "参考售价", CallMethod = "SetOut", Index=57 },
                         new ColRef() {  ColName = "参考货期", CallMethod = "SetDelievery", Index=58 }
                    };
                }
                return _refList;
            }
        }
    }

    public class PictureTable : TableRef
    {
        public override Type ClassType
        {
            get
            {

                return typeof(Picture.Builder);
            }
        }

        private List<ColRef> _refList;
        public override IList<ColRef> RefList
        {
            get
            {
                if (_refList == null)
                {
                    _refList = new List<ColRef>()
                    {
                         new ColRef() {  Index=59, ColName = "图片(外观)", CallMethod = "SetFacade" },
                         new ColRef() {  Index=60, ColName = "图片(尺寸)", CallMethod = "SetSize" },
                         new ColRef() {  Index=61, ColName = "图片(配光1)", CallMethod = "SetGrading1" },
                         //new ColRef() {  Index=62, ColName = "图片(配光2)", CallMethod = "SetGrading2" },
                         //new ColRef() {  Index=63, ColName = "图片(配光3)", CallMethod = "SetGrading3" },
                         new ColRef() {  Index=62, ColName = "图片(实景)", CallMethod = "SetLive" }
                    };
                }
                return _refList;
            }
        }
    }
}
